<template>
    <div>
        <van-nav-bar title="翻译历史记录" left-text="返回" @click-left="onClickLeft" left-arrow />
        <van-empty v-if="!loaded" description="加载中..." />
        <div v-else class="content">
            <div v-for="(item, index) in list" :key="index" class="item">
                <div class="item-title">{{ item.title }}</div>
                <div class="item-content">{{ item.content }}</div>
            </div>
            <div v-if="list.length === 0" class="empty">暂无翻译记录</div>
            <div v-if="list.length > 0" class="footer">{{ list.length }}条记录</div>
        </div>
    </div>
</template>

<script setup>
import { onMounted, ref } from "vue";

const list = ref([
    { title: "翻译前", content: "翻译后" },
    { title: "翻译前", content: "翻译后" },
]);
const loaded = ref(false);
const onClickLeft = () => history.back();
onMounted(() => {
    setTimeout(() => {
        loaded.value = true;
    }, 1000);
})

</script>

<style scoped>
.content {
    padding: 10px;
}

.item {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    font-size: 14px;
    color: #333;

}

.item-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    height: 20px;
}

.item-content {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    height: 20px;
}

.empty {
    text-align: center;
    padding: 20px 0;
    color: #999;
    font-size: 14px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
    border-top: 1px solid #eee;
    margin-top: 10px;
}

.footer {
    text-align: center;
    padding: 20px 0;
    color: #999;
    font-size: 14px;
    font-weight: bold;
    border-top: 1px solid #eee;
    margin-top: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
}
</style>